# Maintainer: David Runge <dvzrv@archlinux.org>

_name=pilkit
pkgname=python-pilkit
pkgver=2.0
pkgrel=12
pkgdesc="A collection of utilities for working with PIL (the Python Imaging Library)"
arch=(any)
url="https://github.com/matthewwithanm/pilkit"
license=(BSD)
depends=(python)
makedepends=(
  python-build
  python-installer
  python-setuptools
  python-wheel
)
# NOTE: ticket about the removal of mock: https://github.com/matthewwithanm/pilkit/issues/54
checkdepends=(
  python-mock
  python-nose
  python-pillow
  python-pytest
)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('7618d7de125f2813b25d707b02b70ca9cb4e19105ed0eb3be3ff6b926a812ed2a609e54f8e86535641fc4baef265fae58d70290c14011eeea744e90066b7bdae')
b2sums=('e612b1f438d17c068dcad5d5150b3593374e7c5b2d08439eb64754cfa3a8c54d298adffa6d57d884bd1b2338b01afb159c238d90d4144608d47d51cc77c14a1c')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  pytest -vv
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 {AUTHORS,README.rst} -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
